IDIR=..
CC=g++
CFLAGS=-g -I$(IDIR)

ODIR=./
LDIR=

LIBS=-lpthread -lgcov

_DEPS = Sorter.h gtest/%.h
DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS))

_OBJ = gmock-gtest-all.o test.o test_logger.o mocktest.o Logger.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))




%.o: %.cpp %.cc 
	g++ -g -c -I./ -o $@  $< $(CFLAGS) 

test_run: $(_OBJ)
	g++ -g -I./ -o $@ $^ $(CFLAGS) $(LIBS)

code.o : code.cpp
	g++ -g -c code.cpp -o code.o
	
code: code.o
	g++ -g -I./ -o $@ $^ $(CFLAGS) $(LIBS)

analysis: Analysis.o
	g++ -g -I./ -o $@ $^ $(CFLAGS) $(LIBS)

.PHONY: clean

clean:
	rm -f test_run code analysis *.o *~ core 

gmock-gtest-all.o: gmock-gtest-all.cc
	g++ -g -c -I./ -fprofile-arcs -ftest-coverage -o $@  $< $(CFLAGS)

test.o: test.cpp
	g++ -g -c -I./ -fprofile-arcs -ftest-coverage -o $@  $< $(CFLAGS)

test_logger.o: test_logger.cpp
	g++ -g -c -I./ -fprofile-arcs -ftest-coverage -o $@  $< $(CFLAGS)




mocktest.o: mocktest.cpp
	g++ -g -c -I./ -fprofile-arcs -ftest-coverage -o $@  $< $(CFLAGS)

Logger.o: Logger.cpp
	g++ -g -c -I./ -fprofile-arcs -ftest-coverage -o $@  $< $(CFLAGS)
